<!DOCTYPE html>
<html lang="en">
<div th:include="common/headjs :: 1024Headerjs"></div>

<body data-type="index">

    <div class="am-g tpl-g">
        <!-- 头部 -->

        <div th:include="common/head :: 1024Header"></div>

        <!-- 风格切换 -->
        
        <!-- 侧边导航栏 -->
        <div th:include="common/left :: 1024Left"></div>

        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">

            <div class="row-content am-cf">
                <div class="row  am-cf">
                </div>

               

 <div class="am-u-sm-12 am-u-md-12 am-u-lg-6">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">最近10个小组</div>
                                <div class="widget-function am-fr">
                                    
                                </div>
                            </div>
                            <div class="widget-body  widget-body-lg am-fr">

                                <table width="100%" class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black " id="example-r">
                                    <thead>
                                        <tr>
                                            <th>小组ID</th>
                                            <th>小组人数</th>
                                            <th>成立时间</th>
                                            
                                        </tr>
                                    </thead>
                                    <tbody id="groupData">

                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>



            </div>
        </div>
    </div>
    </div>
    <script src="/assets/js/amazeui.min.js"></script>
    <script src="/assets/js/amazeui.datatables.min.js"></script>
    <script src="/assets/js/dataTables.responsive.min.js"></script>
    <script src="/assets/js/app.js"></script>


</body>

    <script>


     // $(document).ready(function () {
     //     loadGroupTop10();
     // })

        (function loadGroupTop10() {
            $.ajax({
                'url' : '/group/listTop10Group',
                'dataType' : 'json',
                'type' : 'get',
                'data' : {

                },
                'success' : function (result) {
                    if (result.code != 1000) {
                        alert(result.msg);
                        if (result.code == 5555) {
                            window.location.href = '/';
                        }
                        return;
                    }

                    var groupArray = result.data;
                    var msg = '';
                    for (var i=0; i<groupArray.length; i++) {
                        var group = groupArray[i];
                        msg += '<tr class="gradeX" >\n' +
                            '                                            <td>'+group.id+'</td>\n' +
                            '                                            <td>'+group.groupNum+'</td>\n' +
                            '                                            <td>'+group.createTime+'</td>\n' +
                            '                                        </tr>';
                    }
                    alert(msg);

                    $('#groupData').html(msg);
                },
                'error' : function (result) {
                    error(result);
                }
            });
        })();

    </script>

</html>